import ElementUI, { Message } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

import axios from 'axios'
import qs from 'qs'
import VueResource from 'vue-resource'
Vue.prototype.$qs = qs;

// 请求拦截
axios.interceptors.request.use(
  config => {
    const token = localStorage.getItem('token')
    if (token) {
      config.headers.token = token
    }
    return config
  },
  err => {
    console.log('err:' + err);
    return Promise.reject(err)
  }
)
Vue.prototype.$axios = axios;
// 将弹框组件全局挂载
Vue.prototype.$message = Message;


Vue.use(ElementUI, VueResource)
Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
